<?php

namespace Nimo\Bundle\BookstoreApiBundle\Entity\User;

use Doctrine\ORM\Mapping as ORM;

/**
 * Nimo\Bundle\BookstoreApiBundle\Entity\User\ViewHistory
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="Nimo\Bundle\BookstoreApiBundle\Entity\User\ViewHistoryRepository")
 */
class ViewHistory
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var Book $book
     *
     * @ORM\ManyToOne(targetEntity="Nimo\Bundle\BookstoreApiBundle\Entity\Book\Book", inversedBy="view_history")
     * @ORM\JoinColumn(name="book_id", referencedColumnName="id")
     */
    private $book;

    /**
     * @var User $user
     *
     * @ORM\ManyToOne(targetEntity="User", inversedBy="view_history")
     * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
     */
    private $user;

    /**
     * @var \DateTime $viewDate
     *
     * @ORM\Column(name="view_date", type="datetime")
     */
    private $viewDate;


    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set bookId
     *
     * @param integer $bookId
     * @return ViewHistory
     */
    public function setBookId($bookId)
    {
        $this->bookId = $bookId;
    
        return $this;
    }

    /**
     * Get bookId
     *
     * @return integer 
     */
    public function getBookId()
    {
        return $this->bookId;
    }

    /**
     * Set userId
     *
     * @param integer $userId
     * @return ViewHistory
     */
    public function setUserId($userId)
    {
        $this->userId = $userId;
    
        return $this;
    }

    /**
     * Get userId
     *
     * @return integer 
     */
    public function getUserId()
    {
        return $this->userId;
    }

    /**
     * Set viewDate
     *
     * @param \DateTime $viewDate
     * @return ViewHistory
     */
    public function setViewDate($viewDate)
    {
        $this->viewDate = $viewDate;
    
        return $this;
    }

    /**
     * Get viewDate
     *
     * @return \DateTime 
     */
    public function getViewDate()
    {
        return $this->viewDate;
    }

    /**
     * Set book
     *
     * @param Nimo\Bundle\BookstoreApiBundle\Entity\Book\Book $book
     * @return ViewHistory
     */
    public function setBook(\Nimo\Bundle\BookstoreApiBundle\Entity\Book\Book $book = null)
    {
        $this->book = $book;
    
        return $this;
    }

    /**
     * Get book
     *
     * @return Nimo\Bundle\BookstoreApiBundle\Entity\Book\Book 
     */
    public function getBook()
    {
        return $this->book;
    }

    /**
     * Set user
     *
     * @param Nimo\Bundle\BookstoreApiBundle\Entity\User\User $user
     * @return ViewHistory
     */
    public function setUser(\Nimo\Bundle\BookstoreApiBundle\Entity\User\User $user = null)
    {
        $this->user = $user;
    
        return $this;
    }

    /**
     * Get user
     *
     * @return Nimo\Bundle\BookstoreApiBundle\Entity\User\User 
     */
    public function getUser()
    {
        return $this->user;
    }
}